import { get, post } from './request'
import type { LoginForm, LoginVo, RegisterForm, UserInfoVo } from '@/types'

// 注册
export const register = (params: RegisterForm) => {
    return post<null>('api/user/register', params)
}

// 登录
export const login = (params: LoginForm) => {
    return post<LoginVo>('api/user/login', params)
}

// 验证token
export const checkAuth = () => {
    return post<null>('api/user/protected')
}

// 获取我的信息
export const getMyInfo = () => {
    return get<UserInfoVo>('api/user/me')
}
